# 在不影响函数的定义跟执行代码的前提条件下加日志

# def test(a=1,b=2,c=3):
#     print("this is test",a,b,c)
#     return a+b+c
#
# def test2(a=1,b=2,c=3):
#     print("this is test2",a,b,c)
#     return a+b+c
#
# res = test(2,3,4)
# res2 = test2(4,5,6)
# print(res,res2)


def log(fn):
    def wrapper(a, b, c):
        print(fn.__name__ + "函数开始执行了...")
        res = fn(a, b, c)
        print(fn.__name__ + "函数执行结束了...")
        return res
    return wrapper

@log
def test(a=1,b=2,c=3):
    print("this is test",a,b,c)
    return a+b+c
@log
def test2(a=1,b=2,c=3):
    print("this is test2",a,b,c)
    return a+b+c

res = test(2,3,4)
res2 = test2(4,5,6)
print(res,res2)